package com.lx.design.demo.learning.liu.visitor;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lx
 * @date 2021/3/1 17:23
 */
@Slf4j
public class FADepartment extends Department {

    @Override
    public void visit(FullTimeEmployee employee) {
        int workTime = employee.getWorkTime();
        double weekWage = employee.getWeeklywage();

        if (workTime > 40) {
            weekWage = weekWage + (workTime - 400) * 100;
        } else if (workTime < 40) {
            weekWage = weekWage - (40 - workTime) * 80;
            if (weekWage < 0) {
                weekWage = 0;
            }
        }
        log.info("正式员工{} 实际工资为：{}元", employee.getName(), weekWage);
    }

    @Override
    public void visit(ParttimeEmployee employee) {
        int workTime = employee.getWorkTime();
        double hourWage = employee.getHourWage();
        log.info("临时工{}实际工资为:{}", employee.getName(), workTime * hourWage);

    }
}
